<div class="main-content">
	<div class="breadcrumbs" id="breadcrumbs">
		<!-- .breadcrumb -->
	</div>
	<div class="page-content">
        
        <div class="page-header">
			<h1>编辑钉铛卷</h1>
		</div>
		<div class="row">
			 <div class="col-xs-12">
				<!-- PAGE CONTENT BEGINS -->
					<form id="usrform" action="<?php echo base_url()."admin/activity/edit_coupon"?>" method="post">
				    	<div class="box-body" style="display: inline-block;width: 100%">
					        <div class="form-group col-xs-6">
					            <label>钉铛卷名称</label><span style="color: #a94442;"><?php echo form_error("coupon_name")?></span>
					            <input name="coupon_name" type="text" class="form-control" placeholder="输入 ..." value="<?php echo $result[0]->coupon_name?>" check-type="required">
				            </div>
	                        <div class="form-group col-xs-6">
					            <label>使用天数</label><span style="color: #a94442;"><?php echo form_error("days")?></span>
					            <input name="days" type="text" class="form-control" placeholder="请输入数字" onkeyup="value=value.replace(/[^\d]/g,'') " value="<?php echo $result[0]->days?>" check-type="required">
				            </div>
				            <div class="form-group col-xs-6">
					            <label>发放规则</label>
					            <select name="coupon_type" class="form-control" check-type="required">
				                    <option value="">请选择</option>
		                            <option value="1" <?php if ($result[0]->coupon_type == 1)echo "selected";?>>新用户赠送</option>
		                            <option value="2" <?php if ($result[0]->coupon_type == 2)echo "selected";?>>分享好友首单赠送</option>
		                            <option value="3" <?php if ($result[0]->coupon_type == 3)echo "selected";?>>其他</option>
		                            <option value="4" <?php if ($result[0]->coupon_type == 4)echo "selected";?>>随机</option>
		                            <option value="5" <?php if ($result[0]->coupon_type == 5)echo "selected";?>>车贴审核通过赠送</option>
                                    <option value="6" <?php if ($result[0]->coupon_type == 6)echo "selected";?>>邀请好友注册赠送</option>
									<option value="7" <?php if ($result[0]->coupon_type == 7)echo "selected";?>>邀请3名注册并加油100元以上赠送</option>
									<option value="8" <?php if ($result[0]->coupon_type == 8)echo "selected";?>>加油间隔超过15天</option>
                                    <!--<option value="9" <?php if ($result[0]->coupon_type == 9)echo "selected";?>>货拉拉专属券</option>-->
                                    <option value="10" <?php if ($result[0]->coupon_type == 10)echo "selected";?>>砍价活动</option>
				                </select>
				            </div>
                            <div class="form-group col-xs-6">
					            <label>适用平台</label>
					            <select name="third_id" class="form-control" check-type="required">
				                    
                                    <option value="-1" <?php if ($result[0]->third_id == -1)echo "selected";?>>全平台</option>
                                    <option value="0" <?php if (empty($result[0]->third_id))echo "selected";?>>钉铛平台</option>
		                           	<?php foreach($third as $v):?>
                                    <option value="<?php echo $v['id']?>" <?php if ($result[0]->third_id == $v['id'])echo "selected";?>><?php echo $v['name']?></option>
		                       		<?php endforeach;?>	
		                       			
				                </select>
				            </div>
                            
                            <div class="form-group col-xs-6">
					            <label>加油优惠方式</label>
					            <select name="discount_type" class="form-control" check-type="required">
				                    <option value="0" <?php if ($result[0]->discount_type == 0)echo "selected";?>>默认</option>
		                            <option value="1" <?php if ($result[0]->discount_type == 1)echo "selected";?>>与油站优惠不叠加</option>
				                </select>
				            </div>
                            
				            <div class="form-group col-xs-6">
					            <label>类型</label>
					            <select name="is_gasstation" class="form-control" check-type="required">
				                    <option value="">请选择</option>
		                            <option value="0" <?php if ($result[0]->is_gasstation == 0)echo "selected";?>>钉铛优惠券</option>
		                            <option value="1" <?php if ($result[0]->is_gasstation == 1)echo "selected";?>>加油优惠券</option>
                                    <option value="2" <?php if ($result[0]->is_gasstation == 2)echo "selected";?>>加油卡充值券</option>
                                    <option value="3" <?php if ($result[0]->is_gasstation == 3)echo "selected";?>>违章缴费券</option>
                                    <option value="4" <?php if ($result[0]->is_gasstation == 4)echo "selected";?>>线上通用券</option>
                                    <option value="5" <?php if ($result[0]->is_gasstation == 5)echo "selected";?>>保养抵扣券</option>
				                </select>
				            </div>
				            <div class="form-group col-xs-6">
					            <label>油站类别</label>
					            <select name="gasstation_type" class="form-control" check-type="required">
		                            <option value="0">无限制</option>
		                            <option value="1" <?php if ($result[0]->gasstation_type == 1)echo "selected";?>>A类</option>
                                    <option value="2" <?php if ($result[0]->gasstation_type == 2)echo "selected";?>>B类</option>
                                    <option value="3" <?php if ($result[0]->gasstation_type == 3)echo "selected";?>>C类</option>
				                </select>
				            </div>
				            <div class="form-group col-xs-6">
					            <label>左上标简称</label><span style="color: #a94442;"><?php echo form_error("type_name")?></span>
					            <input name="type_name" type="text" class="form-control" placeholder="请输入" onkeyup="" value="<?php echo $result[0]->type_name?>" check-type="required">
				            </div>
				            <div class="form-group col-xs-6">
					            <label>金额</label><span style="color: #a94442;"><?php echo form_error("amount")?></span>
					            <input name="amount" type="text" class="form-control" placeholder="请输入数字" onkeyup="value=value.replace(/[^\d]/g,'') " value="<?php echo $result[0]->amount?>" check-type="required">
				            </div>
				            <div class="form-group col-xs-6">
					            <label>启用金额</label><span style="color: #a94442;"><?php echo form_error("use_price")?></span>
					            <input name="use_price" type="text" class="form-control" placeholder="请输入数字" onkeyup="value=value.replace(/[^\d]/g,'') " value="<?php echo $result[0]->use_price?>" check-type="required">
				            </div>
				            <div class="form-group col-xs-6">
					            <label>每人发放张数</label>
					            <input name="send_one_number" type="text" class="form-control" placeholder="请输入数字" value="<?php echo $result[0]->send_one_number?>" check-type="required">
				            </div>
			            </div>
			            <div class="clearfix form-actions">
							<div class="col-md-offset-3 col-md-9">
								<input name="id" style="display: none;" value="<?php echo $result[0]->id?>" />
								<button id="btnSubmit" class="btn btn-info" type="submit">
									<i class="icon-ok bigger-110"></i>
									保存
								</button>
	
								&nbsp; &nbsp; &nbsp;
								<a class="btn" href="<?php echo base_url()."admin/activity/coupon"?>">
									<i class="icon-undo bigger-110"></i>
									返回
								</a>
							</div>
						</div>
					</form>
			</div>
		</div><!-- /.row -->
	</div><!-- /.page-content -->
</div><!-- /.main-content -->
<script type="text/javascript">
$("#usrform").validation();
//保存
$("#btnSubmit").on('click',function(event){
  // 2.最后要调用 valid()方法。
  if ($("#usrform").valid()==false){
    return false;
  }
});
</script>